import request from "@/utils/request";
//新增药品
export function newDrugs(data) {
  return request({
    url: "/admin/product/save",
    method: "post",
    data
  });
}
//删除药品信息
export function deleteDrugsData(params) {
  return request({
    url: `/admin/product`,
    method: "delete",
    params
  });
}
//获取药品信息列表
export function getDrugsList(data) {
  return request({
    url: "/admin/product/list",
    method: "post",
    data
  });
}
//获取库存管理列表
export function getWarehouseList(data) {
  return request({
    url: "admin/storage/list",
    method: "post",
    data
  });
}

//药品库存信息接口
export function searchProductById(params) {
  return request({
    url: "/admin/product/search/by-default-id",
    method: "get",
    params: params
  });
}

//获取所有药品分类
export function getDrugsCategory() {
  return request({
    url: "/admin/product/category",
    method: "get"
  });
}
//查看药品详情
export function getDrugsDetail(params) {
  return request({
    url: "/admin/product/detail",
    method: "get",
    params: params
  });
}
//按default-id查详情

export function getDrugsDetailDefId(params) {
  return request({
    url: "admin/product/detail/by-default-id",
    method: "get",
    params: params
  });
}
//查看库存管理详情
export function getDrugsWarehouseDetail(params) {
  return request({
    url: "/admin/storage/detail",
    method: "get",
    params: params
  });
}
export function newEditDrugs(data) {
  return request({
    url: "/admin/storage/edit",
    method: "post",
    data
  });
}
//状态启用停用
export function stateChange(params) {
  return request({
    url: "/admin/product/status",
    method: "put",
    params
  });
}
//医药名称输入联想
export function lenvo(data) {
  return request({
    url: "/admin/product/search/all-prefix",
    method: "post",
    data
  });
}
//包装规格/生产厂家/批准文号输入联想
export function lenvoOther(data) {
  return request({
    url: "/admin/product/search/suggest-prefix",
    method: "post",
    data
  });
}

//获取Json
export function getJson() {
  return request({
    url: "/pub/setting",
    method: "get"
  });
}
//新增或编辑药品信息，提交时匹配defaultId是否有
export function matchDefaultId(data) {
  return request({
    url: "/admin/product/search/default-id",
    method: "post",
    data
  });
}
//自定义分类输入联想

export function self_categoryLenvo() {
  return request({
    url: "/admin/product/self-category",
    method: "get"
  });
}

//------------------------------------------------
//2入库日志分类
export function getCategoryList() {
  return request({
    url: "/admin/product/category",
    method: "get"
  });
}
//2入库日志列表
export function getStoragerList(data) {
  return request({
    url: "/admin/storage/inbound/list",
    method: "POST",
    data
  });
}
//2新增入库
export function addStoragerList(data) {
  return request({
    url: "/admin/storage/inbound/new",
    method: "POST",
    data
  });
}
//2入库拼音搜索1111
export function getCentralList(data, params) {
  return request({
    url: "/admin/product/search/self-prefix",
    method: "POST",
    data,
    params: params
  });
}
//药品库存信息接口(根据default_id)
export function getDefault(id) {
  return request({
    url: `/admin/product/detail/by-default-id?default_id=${id}`,
    method: "get"
  });
}
//库存列表（根据default_id）
export function getOutDefault(id) {
  return request({
    url: `/admin/storage/list/by-default-id?default_id=${id}`,
    method: "get"
  });
}
//2出库列表
export function getOutboundList(data) {
  return request({
    url: "/admin/storage/outbound/list",
    method: "POST",
    data
  });
}
//2出库拼音搜索
export function getOutCentralList(data) {
  return request({
    url: "/admin/storage/search/list",
    method: "POST",
    data
  });
}

//2获取出库类型
export function getInventoryType() {
  return request({
    url: "/admin/storage/outbound/mode",
    method: "get"
  });
}
//2获取库存列表
export function getOutStorageList(data) {
  return request({
    url: "/admin/storage/list",
    method: "post",
    data
  });
}

//2添加库存列表
export function addOutStorageList(data) {
  return request({
    url: "/admin/storage/outbound/new",
    method: "post",
    data
  });
}

//2药品库存预警，有效期提醒
export function getWarningList(data) {
  return request({
    url: "/admin/storage/warning/list",
    method: "post",
    data
  });
}
//2新增盘点
export function addInventory(data) {
  return request({
    url: "/admin/storage/check/new",
    method: "post",
    data
  });
}
//2盘点列表
export function getInventory(data) {
  return request({
    url: "/admin/storage/check/list",
    method: "post",
    data
  });
}
//药品管理导出
export function exportDownload() {
  return request({
    url: "/admin/product/download",
    method: "get",
    responseType: "blob"
  });
}
//药品管理导入

export function exportImport() {
  return request({
    url: "/admin/product/upload",
    method: "post"
  });
}
//药品模板
export function exportTemplate() {
  return request({
    url: "/admin/product/template",
    method: "get",
    responseType: "blob"
  });
}
//入库日志导出
export function exportPutDownload() {
  return request({
    url: "/admin/storage/inbound/download",
    method: "post",
    responseType: "blob"
  });
}

//出库日志导出
export function exportOutDownload() {
  return request({
    url: "/admin/storage/outbound/download",
    method: "post",
    responseType: "blob"
  });
}
//盘库库日志导出
export function exportDiscDownload() {
  return request({
    url: "/admin/storage/check/list/download",
    method: "post",
    responseType: "blob"
  });
}
